package com.bdqn.zhang.quartz;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: tao
 * @Description: talk is cheap,show me the code!
 * @Date: create in 2020/11/25 11:19
 */
@Component
@EnableScheduling
public class SimpleTask {

    @Autowired
    private MyTask mytask;

    @Autowired
    private SimpleDateFormat dateTrans;

    @Scheduled(cron = "*/5 * * * * ? ")
    public void print(){
        System.out.println("当前系统时间为："+dateTrans.format(new Date()));
    }


    // TODO  动态设置cron




}
